import 'package:fluttertoast/fluttertoast.dart';
import 'package:get/get.dart';

import '../bean/app_response.dart';
import '../network/api.dart';
import '../network/request_util.dart';

class ArticleController extends GetxController{

  /// 收藏文章请求
  Future postCollect(int id) async {
    AppResponse<String> collectRes=await HttpGo.instance.post("${Api.collectArticle}$id/json");
    if(collectRes.isSuccessful){
      Fluttertoast.showToast(msg: "收藏成功");
    }
  }

  ///取消收藏请求
  Future postUnCollect(int id) async {
    AppResponse<String> unCollectRes=await HttpGo.instance.post("${Api.uncollectArticel}$id/json");
    if(unCollectRes.isSuccessful){
      Fluttertoast.showToast(msg: "取消收藏");
    }
  }
}